import javax.print.attribute.standard.PrinterMakeAndModel;
import java.util.Random;
//如何获取数组中的随机索引
//int arr[]={1,2,3,4,5};
//Random rand = new Random();
  //      for(int i=0;i<arr.length;i++){
//int randInedex = rand.nextInt(arr.length);//

public class test312 {
    public static void main(String[] args) {
        int arr[]={1,2,3,4,5};
        Random rand = new Random();
        for(int i=0;i<arr.length;i++){
            int randInedex = rand.nextInt(arr.length);
            int temp=arr[i];
             arr[i]=arr[randInedex];
             arr[randInedex]=temp;
        }
      for(int i=0;i<arr.length;i++){
          System.out.println(arr[i]+" ");
      }


    }
}
